package com.my.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.my.framework.dao.DaoProperties;
import com.my.framework.dao.DbUtils;
import com.my.utils.IdWorker;


@Configuration
@EnableConfigurationProperties({ DaoProperties.class })
public class DaoAutoConfiguration {

	DaoProperties daoProperties;
	public DaoAutoConfiguration(DaoProperties daoProperties) {
		this.daoProperties=daoProperties;
	}
	
	@Bean
	public IdWorker idWorker() {
		return new IdWorker(daoProperties.getMachineNo());
	}
	
	@Bean
	public DbUtils dbUtils() {
		return new DbUtils();
	}
}
